﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WebMsg
{
    public class Sms
    {
        // Constants
        public const int LEN_STD = 160;
        public const int LEN_LONG = 153;
        public const int LEN_SENDER = 11;

        public TelAddress From { private set; get; }
        public TelAddress To { private set; get; }
        public String Body { private set; get; }
        public DateTime Sent { get; set; }
        public DateTime Delivered { get; set; }
        public ResultCodes Result { get; set; }

        public int Segments
        {
            get
            {
                if (1 == LongMessage)
                    return (int)((Body.Length / LEN_LONG) + 1);
                else
                    return 1;
            }
        }

        public int LongMessage
        {
            get
            {
                if (Body.Length <= LEN_STD)
                    return 1;
                else
                    return 0;
            }
        }

        public Sms(TelAddress from, TelAddress to, String body)
        {
            this.From = from;
            this.To = to;
            this.Body = body;
        }

        public Sms(TelAddress to, String body)
        {
            this.To = to;
            this.Body = body;
        }
    }
}
